import React from 'react';

class Skill extends React.Component {
    constructor(props) {
        super(props);
        this.displayName = 'Skill';
        this.state = {
            skillDatas: props.data
            // {
            //     name: "顾晨阳",
            //     club: "沈阳第一",
            //     attack: "1.4",
            //     defense: "2.6",
            //     average: "21"
            // },
        }
    }

    componentWillReceiveProps(nextProps) {
        this.setState({
            skillDatas: nextProps.data

        });
    }

    render() {

        // 技术统计
        let skillDataList = this.state.skillDatas.map( function( data, index ) {
            var { name, club, attack, defense, average } = data;
            return (
                <tr key={index}>
                    <td>{name}</td>
                    <td>{club}</td>
                    <td>{attack}</td>
                    <td>{defense}</td>
                    <td>{average}</td>
                </tr>
            )
        }.bind(this))

        return (
            <tbody>
                {skillDataList}
            </tbody>
        );
    }
}

export default Skill;
